import ActionGroup from "./ActionGroup.vue"
import AlgorithmType from "./AlgorithmType.vue"
import moment from "moment";

/**
 * tooltip {boolean}  
 */
const columns = (showOperate) => {
  let arr = [
    // {
    //   type: 'selection',
    //   width: 55
    // },
    {
      label: 'Camera ID',
      prop: 'cameraId',
      width: 170,
      tooltip: false,
    },
    {
      label: 'Location',
      prop: 'location',
      width: 150,
      tooltip: false,
    },
    {
      label: 'Association Algorithm',
      prop: 'algorithmType',
      tooltip: false,
      render: AlgorithmType
    },
    {
      label: 'Resolution Ratio',
      prop: 'ratio',
      tooltip: false,
    },
    {
      label: 'Pixel',
      prop: 'pixel',
      width: 80,
      tooltip: false,
    },
    {
      label: 'IP',
      prop: 'ip',
      width: 130,
      tooltip: false,
    },
    {
      label: 'RTMP Stream Address',
      prop: 'rtmpUrl',
      tooltip: false,
    },
    {
      label: 'State',
      prop: 'status',
      width: 80,
      tooltip: false,
      formatter: (row, column, cellValue, index) => {
        return <div>{
          row.status == 1 ? <div style="color: #53D087">online</div> : <div style='color: #FB393C'>offline</div>
        }</div>
      }
    }
  ]
  if(showOperate) {
    arr.push({
      label: "Operate",
      width: 270,
      render: ActionGroup
    })
  }
  return arr;
};
export default columns;